import * as actionTypes from './constants';
import { fromJS } from 'immutable';

const defaultState = fromJS({
    singerList: [],
    enterLoading: true,  // 控制进场loading
    pullUploading: true, // 控制上拉加载动画
    pullDownLoading: true, // 控制下拉加载动画
    pageCount: 0  // 当前页数【分页功能】
});


// eslint-disable-next-line
export default (state = defaultState, action) => {
    switch (action.type) {
        case action.type = actionTypes.CHANGE_SINGER_LIST:
            return state.set('singerList', action.data);
        case action.type = actionTypes.CHANGE_PAGE_COUNT:
            return state.set('pageCount', action.data);
        case action.type = actionTypes.CHANGE_ENTER_LOADING:
            return state.set('enterLoading', action.data);
        case action.type = actionTypes.CHANGE_PULLUP_LOADING:
            return state.set('pullUpLoading', action.data);
        case action.type = actionTypes.CHANGE_PULLDOWN_LOADING:
            return state.set('pullDownLoading', action.data);
        default:
            return state;
    };
}